<?php
class UserSession_Driver extends Session_Library {
	
	// database connection
	private $db;
	
	public function __construct(){
		$this->db = new MysqlImproved_Driver;
	}
	
	
	public function getUserInfo($username = null){
		$this->db->connect();
		$username = $this->db->escape($username);
		$this->db->prepare(
				"
				SELECT
				*
				FROM
				`users`
				WHERE
				`username` = '$username'
				LIMIT
				1
				;
				"
				);
		$this->db->query();
		$userInfo = $this->db->fetch('array');
		return $userInfo;
	}
	
	public function checkUser($userName = null, $userPassword = null){
		$this->db->connect();
		$userName = $this->db->escape($userName);
		$userPassword = $this->db->escape($userPassword);
		$this->db->prepare(
				"
				SELECT
				*
				FROM
				`users`
				WHERE
				`username` = '$userName'
				AND
				`password` = '$userPassword'
				LIMIT
				1
				;
				"
				);
		return $this->db->query();
	}
}